package com.xpffly.design.mediator.service;

import com.xpffly.design.mediator.service.impl.Purchase;
import com.xpffly.design.mediator.service.impl.Sale;
import com.xpffly.design.mediator.service.impl.Stock;

/**
 * @Author: xpengfei
 * @Date: 2021/4/5 11:54
 * @Description：抽象中介者
 */
public abstract class AbstractMediator {
    /**
     * 采购管理
     */
    protected Purchase purchase;
    /**
     * 销售管理
     */
    protected Sale sale;
    /**
     * 库存管理
     */
    protected Stock stock;

    /**
     * 构造函数初始化同事对象
     */
    public AbstractMediator() {
        purchase = new Purchase(this);
        sale = new Sale(this);
        stock = new Stock(this);
    }

    /**
     * 中介者中最重要的方法，事件方法，处理多个对象之间的关系
     *
     * @param type
     * @param objects
     */
    public abstract void execute(String type, Object... objects);
}
